//
//  LogoDetailViewController.m
//  Quiz
//
//  Created by Ha Cong Thuan on 3/26/14.
//  Copyright (c) 2014 Ha Cong Thuan. All rights reserved.
//

#import "LogoDetailViewController.h"

@interface LogoDetailViewController ()

@end

@implementation LogoDetailViewController{
    float x;
    float y;
}
@synthesize subModel;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}
-(void)viewWillAppear:(BOOL)animated{
    [imgLogo setImageWithURL:[NSURL URLWithString:subModel.img_thumb]];
    [self createButtonWithArr:nil];
}
- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
-(void)createButtonWithArr:(NSMutableArray*)arr{
    if (IS_IPHONE_5)
    {
         y=270;
        // this is iphone 4 inch
    }
    else
    {
         y=220;
        //Iphone  3.5 inch
    }
   
    for( int i = 0; i <9; i++ ) {
        x=x+30;
        CGRect frame=CGRectMake(x, y, 30, 30);
        UIButton* aButton = [self createButtonWithFrame:frame];
        [aButton setTag:i];
        [aButton setBackgroundImage:[UIImage imageNamed:@"btn_input.png"] forState:UIControlStateNormal];
        [aButton addTarget:self action:@selector(buttonClicked:) forControlEvents:UIControlEventTouchUpInside];
        [self.view addSubview:aButton];
    }
    
}
- (void)buttonClicked:(UIButton*)button{
    {
        NSLog(@"Button %ld clicked.", (long int)[button tag]);
    }
    
}
-(UIButton *)createButtonWithFrame:(CGRect)frame{
    UIButton *btn=[[UIButton alloc]initWithFrame:frame];
    
    
    return btn;
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
